package com.hzncc.scaffold.controller.Front.TrainingClass;

import cn.dev33.satoken.stp.StpUtil;
import com.hzncc.scaffold.core.ResultT;
import com.hzncc.scaffold.entity.Other.User;
import com.hzncc.scaffold.service.UserService;
import com.netflix.discovery.converters.Auto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: DrunkBear
 * @Date: 2022-06-14 14:14
 * @Description: null
 */
@RequestMapping("/trainingClass")
@Api(tags = "前台接口-实训课程")
@RestController
public class TrainingClassController {

    @Autowired
    UserService userService;

    @GetMapping("/confirmUserInfo")
    @ApiOperation("确认用户信息")
    public ResultT confirmUserInfo(){
        if(StpUtil.isLogin()){
            int userId = StpUtil.getLoginIdAsInt();
            User user = userService.getById(userId);
            return ResultT.success(user);
        }else {
            return  ResultT.fail("未登录");
        }
    }
}
